package org.liulinlin.sejw.db;

import java.sql.*;

public class BLInfo {
	private String id;
	private String signPlace;
	private Date signTime;
	private String signTimeString;
	private String transTerm;
	private String freightTerm;
	private FormEmployee formEmployee;
	private Date opTime;
	private String opTimeString;
	private String comments;
	
	public BLInfo() {
		
	}
	public BLInfo(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("BLInfo不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from BLInfo where BL_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			signPlace = rs.getString("BL_SignPlace");
			signTime = rs.getDate("BL_SignTime");
			if (signTime != null) {
				signTimeString = signTime.toString();
			}
			transTerm = rs.getString("BL_TransTerm");
			freightTerm = rs.getString("BL_FreightTerm");
			formEmployee = new FormEmployee(rs.getString("FE_ID"));
			opTime = rs.getDate("BL_OPTime");
			if (opTime != null) {
				opTimeString = opTime.toString();
			}
			comments = rs.getString("BL_Comments");
			
			stmt.close();
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setSignPlace(String signPlace) {
		this.signPlace = signPlace;
	}
	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}
	public void setSignTimeString(String signTimeString) {
		this.signTimeString = signTimeString;
	}
	public void setTransTerm(String transTerm) {
		this.transTerm = transTerm;
	}
	public void setFreightTerm(String freightTerm) {
		this.freightTerm = freightTerm;
	}
	public void setFormEmployee(FormEmployee formEmployee) {
		this.formEmployee = formEmployee;
	}
	public void setOPTime(Date opTime) {
		this.opTime = opTime;
	}
	public void setOPTimeString(String opTimeString) {
		this.opTimeString = opTimeString;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	
	public String getId() {
		return id;
	}
	public String getSignPlace() {
		return signPlace;
	}
	public Date getSignTime() {
		return signTime;
	}
	public String getSignTimeString() {
		return signTimeString;
	}
	public String getTransTerm() {
		return transTerm;
	}
	public String getFreightTerm() {
		return freightTerm;
	}
	public FormEmployee getFormEmployee() {
		return formEmployee;
	}
	public Date getOPTime() {
		return opTime;
	}
	public String getOPTimeString() {
		return opTimeString;
	}
	public String getComments() {
		return comments;
	}
}
